<template>
<div class="quick-container">
  <div class="title">
    <span class="c-font-12">快捷入口</span>
  </div>
  <div class="card-box">
    <div class="card-item" v-for="(item,index) in list" :key="index" @click="change(index)"
    :style="{background:current===index?activeBg:'',color:current===index?activeColor:''}">
      <img :src='current == index?item.activeImg:item.img'>
      <p class="c-font-8 c-m-t-2">{{item.title}}</p>
    </div>
  </div>
</div>
</template>

<script>
export default {
  name: "Quick-card",
  props:{
  //  激活时背景颜色
    activeBg:{
      type:String,
      default:'#F3131D'
    },
  //  激活时字体颜色
    activeColor:{
      type:String,
      default: '#ffffff'
    }
  },
  data(){
    return{
      //当前选中下标
      current:0,
      list:[
        {
          img:require('@/assets/icons/quick-card/cateen.png'),
          activeImg:require('@/assets/icons/quick-card/active-catten.png'),
          title:"食堂管理"
        },
        {
          img:require('@/assets/icons/quick-card/caipin.png'),
          activeImg:require('@/assets/icons/quick-card/active-caipin.png'),
          title:"菜品管理"
        },
        {
          img:require('@/assets/icons/quick-card/caipu.png'),
          activeImg:require('@/assets/icons/quick-card/active-caipu.png'),
          title:"菜谱管理"
        },
        {
          img:require('@/assets/icons/quick-card/quyu.png'),
          activeImg:require('@/assets/icons/quick-card/active-quyu.png'),
          title:"区域设置"
        },
        {
          img:require('@/assets/icons/quick-card/bumen.png'),
          activeImg:require('@/assets/icons/quick-card/active-bumen.png'),
          title:"部门设置"
        },
        {
          img:require('@/assets/icons/quick-card/option.png'),
          activeImg:require('@/assets/icons/quick-card/active-option.png'),
          title:"操作日志"
        },
        {
          img:require('@/assets/icons/quick-card/user.png'),
          activeImg:require('@/assets/icons/quick-card/active-user.png'),
          title:"用户管理"
        },
        {
          img:require('@/assets/icons/quick-card/role.png'),
          activeImg:require('@/assets/icons/quick-card/active-role.png'),
          title:"角色管理"
        }
      ]
    }
  },
  methods:{
    change(index){
      if(this.current!=index){
        this.current=index
      }
    }
  }
}
</script>

<style scoped lang="scss">
.quick-container{
  border-radius: 6px;
  opacity: 1;
  background: #FFFFFF;
  box-shadow: 0px 0px 16px rgba(96, 96, 96, 0.16);
  .title{
    padding: 20px 20px 0 20px;
  }
  .card-box{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-evenly;
    margin: 0 20px 20px 20px;

    .card-item{
      width: 20%;
      margin-top: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      color: #666666;
      padding: 10px 5px;
      background: #FFFFFF;
      opacity: 1;
      border-radius: 6px;
      border: 1px solid #DFDFDF;
      :hover{
        cursor: pointer;
      }
      img{
        width: 20px;
        height: 20px;
      }
    }
  }
}
</style>